package com.isoft.demo01.service.impl;


import com.isoft.demo01.dao.UserManageDAO;
import com.isoft.demo01.entity.User;
import com.isoft.demo01.service.UserManageService;

import com.isoft.demo01.util.IdUtil;
import com.isoft.demo01.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserManageServiceImpl implements UserManageService {

    @Autowired
    private UserManageDAO userManageDAO;

    @Override
    public List<User> listUser() {
        return userManageDAO.listUser();
    }



    @Override
    public boolean updateUser(Integer userid,String username,String email,String phone) {

        if (!IdUtil.idcheck(userid)){
            return false;
        }
        return userManageDAO.update(userid,username, email, phone)>0;
    }

    @Override
    public Boolean delete(Integer userid) {
        if (userid<=0) {
            return null;
        }
        return userManageDAO.delete(userid)>0;
    }
}
